package com.judian.smart.model;


import androidx.annotation.NonNull;

/**
 * Created by Administrator on 2017/8/16.
 */

public class History implements Comparable<History>{
    public String content ;
    public String gatewayId;
    public String masterId ;
    public String operateTake ;
    public String timeStr ;
    //排序用
    public int year;
    public int time;

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getGatewayId() {
        return gatewayId;
    }

    public void setGatewayId(String gatewayId) {
        this.gatewayId = gatewayId;
    }

    public String getMasterId() {
        return masterId;
    }

    public void setMasterId(String masterId) {
        this.masterId = masterId;
    }

    public String getOperateTake() {
        return operateTake;
    }

    public void setOperateTake(String operateTake) {
        this.operateTake = operateTake;
    }

    public String getTimeStr() {
        return timeStr;
    }

    public void setTimeStr(String timeStr) {
        this.timeStr = timeStr;
    }

    @Override
    public String toString() {
        return "History{" +
                "content='" + content + '\'' +
                ", gatewayId='" + gatewayId + '\'' +
                ", masterId='" + masterId + '\'' +
                ", operateTake='" + operateTake + '\'' +
                ", timeStr='" + timeStr + '\'' +
                ", year=" + year +
                ", time=" + time +
                '}';
    }
    //大到小
    @Override
    public int compareTo(@NonNull History history) {
        int i =  history.getYear()-this.getYear();//先按照年月日排序
        if(i == 0){
            return history.getTime()-this.getTime();//如果年龄相等了再用时间进行排序
        }
        return i;
    }
}
